package com.snail.auction.model;

import java.math.BigDecimal;
import java.sql.Date;

public class Bid {
	private int bidId;
	private BigDecimal bidPrice;
	private Date bidDate;
	private Item bidItem;
	private AuctionUser bidUser;
	public int getBidId() {
		return bidId;
	}
	public void setBidId(int bidId) {
		this.bidId = bidId;
	}
	
	public BigDecimal getBidPrice() {
		return bidPrice;
	}
	public void setBidPrice(BigDecimal bidPrice) {
		this.bidPrice = bidPrice;
	}
	public Date getBidDate() {
		return bidDate;
	}
	public void setBidDate(Date bidDate) {
		this.bidDate = bidDate;
	}
	public Item getBidItem() {
		return bidItem;
	}
	public void setBidItem(Item bidItem) {
		this.bidItem = bidItem;
	}
	public AuctionUser getBidUser() {
		return bidUser;
	}
	public void setBidUser(AuctionUser bidUser) {
		this.bidUser = bidUser;
	}
	public int hashCode(){
		return bidUser.getUsername().hashCode()+bidItem.hashCode()+bidPrice.intValue();
	}
	public boolean equals(Object obj){
		if(obj instanceof Bid){
			Bid bid = (Bid) obj;
			if(bid.getBidUser().getUsername().equals(bidUser.getUsername())
				&&bid.getBidItem().equals(bidItem)
				&&bid.getBidPrice()==bidPrice){
				return true;
			}
		}
		return false;
		
	}
}
